A Depth of Field effect. More...
A Depth of Field effect.
This effect will mimick the depth of field of a camera, and blur everything that is not in the focal plane of it. It is typically used to give a good sense of depth to an image, and can sometimes fool perception. For instance, a very narrow focal area (near and far close to each other) will make everything feel small, like small toys. It can also make obvious the parts that should attract attention, by focusing on the important objects in a given scene and blurring all its surrounding.
nkAstraeus::DofComplexEffect::DofComplexEffect | ( | const nkMemory::StringView & | name | ) |
Default constructor. See ComplexEffectManager::createOrRetrieve().
nkAstraeus::DofComplexEffect::~DofComplexEffect | ( | ) |
Default destructor. See ComplexEffectManager::erase().
|
overridevirtual |
Implements nkAstraeus::ComplexEffect.
nkGraphics::Texture* nkAstraeus::DofComplexEffect::getSourceTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::DofComplexEffect::getSourceDepth | ( | ) | const |
nkGraphics::Texture* nkAstraeus::DofComplexEffect::getOutputTexture | ( | ) | const |
nkGraphics::Camera* nkAstraeus::DofComplexEffect::getCamera | ( | ) | const |
float nkAstraeus::DofComplexEffect::getNearPlaneDistance | ( | ) | const |
float nkAstraeus::DofComplexEffect::getFocalPlaneDistance | ( | ) | const |
float nkAstraeus::DofComplexEffect::getFarPlaneDistance | ( | ) | const |
unsigned int nkAstraeus::DofComplexEffect::getBlurStrength | ( | ) | const |
bool nkAstraeus::DofComplexEffect::getLinearDepth | ( | ) | const |
void nkAstraeus::DofComplexEffect::setSourceTexture | ( | nkGraphics::Texture * | value | ) |
Sets the texture to use as input to the effect.
value | The texture to use as input. |
void nkAstraeus::DofComplexEffect::setSourceDepth | ( | nkGraphics::Texture * | value | ) |
Sets the depth texture to use as input to the effect.
value | The depth texture to use as input. |
void nkAstraeus::DofComplexEffect::setCamera | ( | nkGraphics::Camera * | value | ) |
Sets the camera used to retrieve the projection parameters from. Defaults to nullptr, retrieving the camera information from the active context's camera.
value | The camera to use to get the projection information. |
void nkAstraeus::DofComplexEffect::setNearPlaneDistance | ( | float | value | ) |
Sets the near plane distane, in world unit, from the camera. All pixels closer than this distance will get fully blurred. Between the focal plane and the near plane, pixels will gradually get blurrier as they approach the near plane.
value | The near distance, in world unit. |
void nkAstraeus::DofComplexEffect::setFocalPlaneDistance | ( | float | value | ) |
Sets the focal plane distane, in world unit, from the camera. This distance is the one for which the pixels will be in focus and thus sharp. As pixels get closer to the near or far plane, they will get blurrier.
value | The focal distance, in world unit. |
void nkAstraeus::DofComplexEffect::setFarPlaneDistance | ( | float | value | ) |
Sets the far plane distane, in world unit, from the camera. All pixels further away than this distance will get fully blurred. Between the focal plane and the far plane, pixels will gradually get blurrier as they approach the far plane.
value | The far distance, in world unit. |
void nkAstraeus::DofComplexEffect::setBlurStrength | ( | unsigned int | value | ) |
Sets the blurring strength when reaching either the near or far plane. This can be interpreted as the the final blurring radius. Defaults to 3.
value | The blurring strength to apply. |
void nkAstraeus::DofComplexEffect::setLinearDepth | ( | bool | value | ) |
Sets whether the depth information texture should be considered linear, or not. Linear depth information will be between [0, 1] and simply be mapped to the camera's settings (near + depth * (far - near)). If not linear, then the camera's projection parameter will be used to reconstruct linear depth before deducing the depth in world units. Defaults to false.
value | Whether depth data should be considered as already linear (true) or not (false). |
|
overridevirtual |
Implements nkAstraeus::ComplexEffect.
|
overridevirtual |
Implements nkAstraeus::ComplexEffect.